<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>找回密码</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="Keywords" content="网站关键词">
    <meta name="Description" content="网站介绍">
    <link rel="stylesheet" th:href="@{/login/css/base.css}">
    <link rel="stylesheet" th:href="@{/login/css/iconfont.css}">
    <link rel="stylesheet" th:href="@{/login/css/reg.css}">
</head>
<body>
<div id="ajax-hook"></div>
<div class="wrap">
    <div class="wpn">
        <div class="form-data find_password">
            <p th:if="${not #strings.isEmpty(a)}" th:text="${a}" style="color: red"></p>
            <h4>找回密码</h4>
            <p class="right_now">已有账号，<a th:href="@{/login1}">马上登录</a></p>
            <form th:action="@{/upUsers}" method="post">
            <p class="p-input pos">
                <label for="pc_tel">手机号/邮箱</label>
                <input type="text" id="pc_tel" name="phone">
                <!--<span class="tel-warn pc_tel-err hide"><em>最多五个字</em><i class="icon-warn"></i></span>-->
            </p>
            <p class="p-input pos ">
                <label for="veri-code">输入验证码</label>
                <input type="number" name="yzm" id="veri-code">
                <a onclick="fasong()" class="send">发送验证码</a>
                <span class="time hide"><em>120</em>s</span>
                <span class="tel-warn error hide"><em>验证码错误，请重新输入</em><i class="icon-warn"></i></span>
            </p>
            <p class="p-input pos ">
                <label for="veri-code">新的密码</label>
                <input type="number" name="usersPassword" id="veri-code2">
            </p>
            <p class="p-input pos code pc-code">
                <label for="veri">请输入验证码</label>
                <input type="text" id="veri">
                <img src="">
                <span class="tel-warn img-err hide"><em>最多五个字</em><i class="icon-warn"></i></span>
                <!-- <a href="javascript:;">换一换</a> -->
            </p>
            <button class="submit" type="submit">提交</button>
            <p class="right">Powered by © 2018</p>
            </form>
        </div>
    </div>
</div>
<script th:src="@{/login/js/jquery.js}"></script>
<script th:src="@{/login/js/agree.js}"></script>
<script th:src="@{/login/js/reset.js}"></script>
</body>
<script type="text/javascript">
    $(".form-data").delegate(".send","click",function () {
        // var phone = $.trim($('#num2').val());
        var phone=$("#pc_tel").val();
        if (true) {
            $.ajax({
                url: '/getcode',
                type: 'post',
                dataType: 'json',
                async: true,
                data: {phone:phone,type:"login"},
                success:function(data){
                    return true;
                    if (data.code == '0') {

                    } else {

                    }
                },
                error:function(){

                }
            });
            var oTime = $(".form-data .time"),
                oSend = $(".form-data .send"),
                num = parseInt(oTime.text()),
                oEm = $(".form-data .time em");
            $(this).hide();
            oTime.removeClass("hide");
            var timer = setInterval(function () {
                var num2 = num-=1;
                oEm.text(num2);
                if(num2==0){
                    clearInterval(timer);
                    oSend.text("重新发送验证码");
                    oSend.show();
                    oEm.text("120");
                    oTime.addClass("hide");
                }
            },1000);
        }
    });
</script>
<style>
    .submit{
        width: 340px;
        font-size: 18px;
        font-weight: bold;
        color: white;
        height: 50px;
        line-height: 50px;
        text-align: center;
        margin: 20px auto;
        display: block;
        border-radius: 5px;
        cursor: pointer;
        background-color: #42a5f5;
    }
</style>
</html>